<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">

		<title>地址管理</title>

		<link href="/Public/person/AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css">
		<link href="/Public/person/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css">

		<link href="/Public/person/css/personal.css" rel="stylesheet" type="text/css">
		<link href="/Public/person/css/addstyle.css" rel="stylesheet" type="text/css">
		
		<script src="/Public/person/AmazeUI-2.4.2/assets/js/jquery.min.js" ></script>
		<script src="/Public/person/AmazeUI-2.4.2/assets/js/amazeui.js"></script>


		<!-- Theme CSS
		============================================ -->
   		<link href="/Public/mobilemall/css/themecss/so_megamenu.css" rel="stylesheet">
		<link id="color_scheme" href="/Public/mobilemall/css/theme.css" rel="stylesheet">

		 <!-- Libs CSS
		============================================ -->
	   	<link rel="stylesheet" href="/Public/mobilemall/css/bootstrap/css/bootstrap.min.css">
		<link href="/Public/mobilemall/css/font-awesome/css/font-awesome.min.css" rel="stylesheet">
		<link href="/Public/mobilemall/js/datetimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet">
	   	<link href="/Public/mobilemall/js/owl-carousel/owl.carousel.css" rel="stylesheet">
		<link href="/Public/mobilemall/css/themecss/lib.css" rel="stylesheet">
		<link href="/Public/mobilemall/js/jquery-ui/jquery-ui.min.css" rel="stylesheet">	
		<style >

		</style>

	</head>

	<body style="background: #F5F8FA">
		<!--头 -->
		
			<!-- Header Container  -->
	<header id="header" class=" variantleft type_1">
<!-- Header Top -->
<div class="header-top compact-hidden">
	<div class="container">
		<div class="row">
			<div class="header-top-left form-inline col-sm-6 col-xs-12 compact-hidden">
				<div class="form-group languages-block ">
					<form action="index.html" method="post" enctype="multipart/form-data" id="bt-language">
						<a class="btn btn-xs dropdown-toggle" data-toggle="dropdown">
							<img src="/Public/mobilemall/image/demo/flags/cn.png" alt="Chinese" title="Chinese">
							<span class="">中文</span>
							<span class="fa fa-angle-down"></span>
						</a>
						<ul class="dropdown-menu">
							<li> <a href=""> <img class="image_flag" src="/Public/mobilemall/image/demo/flags/cn.png" alt="Chinese" title="Chinese" /> 中文 </a> </li>
							<li><a href=""><img class="image_flag" src="/Public/mobilemall/image/demo/flags/gb.png" alt="English" title="English" /> English </a></li>
							<li> <a href=""> <img class="image_flag" src="/Public/mobilemall/image/demo/flags/lb.png" alt="Arabic" title="Arabic" /> Arabic </a> </li>
						</ul>
					</form>
				</div>

				<div class="form-group currencies-block">
				
				<span class="btn btn-xs dropdown-toggle" style="margin-top: 5px;">
				<?php if(($_SESSION['USERNAME']) == ""): ?>&nbsp;&nbsp;亲，请先<a href="/Home/User/login.html">登录</a>
				，免费<a href="/Home/User/register.html">注册</a> 
				<?php else: ?>
				&nbsp;&nbsp;<?php echo (session('USERNAME')); ?>，你好<?php endif; ?>
				</span>

					
				</div>
			</div>
			<div class="header-top-right collapsed-block text-right  col-sm-6 col-xs-12 compact-hidden">
				<h5 class="tabBlockTitle visible-xs">More<a class="expander " href="#TabBlock-1"><i class="fa fa-angle-down"></i></a></h5>
				<div class="tabBlock" id="TabBlock-1">
					<ul class="top-link list-inline">
						<li class="account" id="my_account">
							<a href="#" title="My Account" class="btn btn-xs dropdown-toggle" data-toggle="dropdown"> <span >
							<?php if(($_SESSION['USERNAME']) == ""): else: ?>
							<?php echo (session('USERNAME')); ?>的<?php endif; ?>
							个人中心</span> <span class="fa fa-angle-down"></span></a>
							<ul class="dropdown-menu ">
								<li><a href="/Home/Person/index"><i class="fa fa-user"></i> 个人主页</a></li>
								<li><a href="/Home/User/userLoginout"><i class="fa fa-pencil-square-o"></i> 注销</a></li>
							</ul>
						</li>
						<li class="wishlist"><a href="#" id="wishlist-total" class="top-link-wishlist" title="Wish List (2)"><span>收藏列表 (2)</span></a></li>
						<li class="login"><a href="#" title="Shopping Cart"><span >购物车</span></a></li>
						<li class="checkout"><a href="/Home/Index/index.html" class="top-link-checkout" title="Checkout"><span >商城首页</span></a></li>
					</ul>
				</div>
			</div>
		</div>
	</div>
</div>
<!-- //Header Top -->

<!-- Header center -->
<div class="header-center left">
	<div class="container">
		<div class="row">
			<!-- Logo -->
			<div class="navbar-logo col-md-3 col-sm-12 col-xs-12">
				<a href="index.html"><img src="/Public/mobilemall/image/demo/logos/theme_logo.png" title="Your Store" alt="Your Store" /></a>
			</div>
			<!-- //end Logo -->

			<!-- Search -->
			<div id="sosearchpro" class="col-sm-7 search-pro">
				<form method="GET" action="index.html">
					<div id="search0" class="search input-group">
						<div class="select_category filter_type icon-select">
							<select class="no-border" name="category_id" id="sort_list_sel">
								<option value="0">所有商品分类</option>
								
							</select>
						</div>

						<input class="autosearch-input form-control" type="text" value="" size="50" autocomplete="off" placeholder="搜索想要的商品" name="search">
						<span class="input-group-btn">
						<button type="submit" class="button-search btn btn-primary" name="submit_search"><i class="fa fa-search"></i></button>
						</span>
					</div>
					<input type="hidden" name="route" value="product/search" />
				</form>
			</div>
			<!-- //end Search -->

		
		</div>

	</div>
</div>
<!-- //Header center -->




	</header>
		
		<b class="line"></b>

		<div class="center">
			<div class="col-main">
				<div class="main-wrap">

					<div class="user-address">
						<!--标题 -->
						<div class="am-modal am-modal-no-btn" id="doc-modal-1">

							<div class="add-dress">

								<!--标题 -->
								<div class="am-cf am-padding">
									<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">编辑地址</strong> / <small>Edit&nbsp;address</small></div>
								</div>
								<hr/>

								<div class="am-u-md-12 am-u-lg-8" style="margin-top: 20px;">
									<form class="am-form am-form-horizontal" method="post" action="/Home/Person/addaddress?addressid=<?php echo ($addressdata["id"]); ?>">

										<div class="am-form-group">
											<label for="user-name" class="am-form-label">收货人</label>
											<div class="am-form-content">
												<input type="text" id="user-name" placeholder="收货人" name="consignor" value="<?php echo ($addressdata["consignor"]); ?>">
											</div>
										</div>

										<div class="am-form-group">
											<label for="user-phone" class="am-form-label">手机号码</label>
											<div class="am-form-content">
												<input id="user-phone" placeholder="手机号必填" type="text" name="telephone" value="<?php echo ($addressdata["telephone"]); ?>">
											</div>
										</div>
										<div class="am-form-group">
											<label for="user-address" class="am-form-label">所在地</label>
											<div class="am-form-content address">
												<select data-am-selected name="province" id="selprovince" onchange="changecity(this);">
												<option value="<?php echo ($addressdata["province"]); ?>"><?php echo ($addressdata["provincename"]); ?></option>     
												<?php if(is_array($provincelist)): $i = 0; $__LIST__ = $provincelist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i; if(($vo["id"]) == $addressdata["province"]): else: ?>
												<option value="<?php echo ($vo["id"]); ?>"><?php echo ($vo["provincename"]); ?></option><?php endif; endforeach; endif; else: echo "" ;endif; ?>
                                                                    								  
												</select>
												<select data-am-selected name="city" id="selcity" onchange="changedistrict(this)">
													<option value="<?php echo ($addressdata["city"]); ?>"><?php echo ($addressdata["cityname"]); ?></option>
													<?php if(is_array($citylist)): $i = 0; $__LIST__ = $citylist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i; if(($vo["id"]) == $addressdata["city"]): else: ?>
												<option value="<?php echo ($vo["id"]); ?>"><?php echo ($vo["cityname"]); ?></option><?php endif; endforeach; endif; else: echo "" ;endif; ?>
												</select>
												<select data-am-selected name="district" id="seldistrict">
													<option value="<?php echo ($addressdata["district"]); ?>"><?php echo ($addressdata["districtname"]); ?></option>
													<?php if(is_array($districtlist)): $i = 0; $__LIST__ = $districtlist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i; if(($vo["id"]) == $addressdata["district"]): else: ?>
												<option value="<?php echo ($vo["id"]); ?>"><?php echo ($vo["districtname"]); ?></option><?php endif; endforeach; endif; else: echo "" ;endif; ?>
												</select>
											</div>
										</div>

										<div class="am-form-group">
											<label for="user-intro" class="am-form-label">详细地址</label>
											<div class="am-form-content">
												<textarea class="" rows="3" id="user-intro" placeholder="输入详细地址" name="detaddress" ><?php echo ($addressdata["detaddress"]); ?></textarea>
												<small>100字以内写出你的详细地址...</small>
											</div>
										</div>

										<div class="am-form-group">
											<div class="am-u-sm-9 am-u-sm-push-3">
												<button type="submit" class="am-btn am-btn-danger tpl-btn-bg-color-success ">确认修改</button>
												
											</div>
										</div>
									</form>
								</div>

							</div>

						</div>
						
					</div>

					<script type="text/javascript">
						$(document).ready(function() {	
							//改变默认地址						
							$(".new-option-r").click(function() {
								$(this).parent('.user-addresslist').addClass("defaultAddr").siblings().removeClass("defaultAddr");
								$(this).html("<i class='am-icon-check-circle'></i>默认地址").parent('.user-addresslist').siblings().children("span.new-option-r").html("<i class='am-icon-check-circle'></i>设为默认");
								var addressid = $(this).parents('.user-addresslist').attr('cid'); 
								//alert(addressid);
								$.post('/API/Address/changedefault',{"addressid":addressid},function(res){
								                  	
							                         
						            		});
							});
							//删除地址

							var $ww = $(window).width();
							if($ww>640) {
								$("#doc-modal-1").removeClass("am-modal am-modal-no-btn")
							};


							


							
						});


					</script>

					<div class="clear"></div>

				</div>
				<!--底部-->
				<div class="footer">
					<div class="footer-hd">
						<p>
							<a href="#">恒望科技</a>
							<b>|</b>
							<a href="#">商城首页</a>
							<b>|</b>
							<a href="#">支付宝</a>
							<b>|</b>
							<a href="#">物流</a>
						</p>
					</div>
					<div class="footer-bd">
						<p>
							<a href="#">关于恒望</a>
							<a href="#">合作伙伴</a>
							<a href="#">联系我们</a>
							<a href="#">网站地图</a>
							<em>© 2015-2025 Hengwang.com 版权所有</em>
						</p>
					</div>
				</div>
			</div>

			<aside class="menu">
				<ul>
					<li class="person ">
						<a href="/Home/Person/index"><i class="am-icon-user"></i>个人中心</a>
					</li>
					<li class="person">
						<a href="#"><i class="am-icon-newspaper-o"></i>个人资料</a>
						<ul>
							<li> <a href="/Home/Person/information">个人信息</a></li>
							<li > <a href="/Home/Person/safety">安全设置</a></li>
							<li class="active"> <a href="/Home/Person/address">收货地址</a></li>
						</ul>
					</li>
					<li class="person">
						<a href="#"><i class="am-icon-balance-scale"></i>我的交易</a>
						<ul>
							<li><a href="order.html">订单管理</a></li>
							<li> <a href="change.html">退款售后</a></li>
						</ul>
					</li>
					<li class="person">
						<a href="#"><i class="am-icon-dollar"></i>我的资产</a>
						<ul>
							<li> <a href="coupon.html">优惠券 </a></li>
							<li> <a href="bonus.html">红包</a></li>
							<li> <a href="bill.html">账单明细</a></li>
						</ul>
					</li>

					<li class="person">
						<a href="#"><i class="am-icon-tags"></i>我的小窝</a>
						<ul>
							<li> <a href="collection.html">收藏</a></li>
							<li> <a href="foot.html">足迹</a></li>
							<li> <a href="comment.html">评价</a></li>
							<li> <a href="news.html">消息</a></li>
						</ul>
					</li>

				</ul>

			</aside>
		</div>

<!-- Placed at the end of the document so the pages load faster -->

<script type="text/javascript" src="/Public/mobilemall/js/jquery-2.2.4.min.js"></script>

<script type="text/javascript" src="/Public/mobilemall/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/Public/mobilemall/js/owl-carousel/owl.carousel.js"></script>
<script type="text/javascript" src="/Public/mobilemall/js/themejs/libs.js"></script>
<script type="text/javascript" src="/Public/mobilemall/js/unveil/jquery.unveil.js"></script>
<script type="text/javascript" src="/Public/mobilemall/js/countdown/jquery.countdown.min.js"></script>
<script type="text/javascript" src="/Public/mobilemall/js/dcjqaccordion/jquery.dcjqaccordion.2.8.min.js"></script>
<script type="text/javascript" src="/Public/mobilemall/js/datetimepicker/moment.js"></script>
<script type="text/javascript" src="/Public/mobilemall/js/datetimepicker/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="/Public/mobilemall/js/jquery-ui/jquery-ui.min.js"></script>

<!-- Theme files
============================================ -->
<script type="text/javascript" src="/Public/mobilemall/js/themejs/application.js"></script>

<script  type="text/javascript">
 //改变显示的城市列表
             function changecity(obj){
          		var a=$(obj).val();
                         if (a!=0) {
                                       $.ajax({
                                                    type: "POST",
                                                    url: "<?php echo u('/API/Address/loadcity');?>",
                                                    data: {"provinceid":a},
                                                    dataType: "json",
                                                    success: function (res) {   
                                                                 $("#selcity").html("<option value=''>请选择城市</option>");
                                                                 $.each(res.data, function(i, item) {
                                                                             $("#selcity").append("<option value='" + item.id + "'>" + item.cityname + "</option>");
                                                                  });
                                                    },  
                                                    eror: function (res) {   
                                                                 alert("请求超时!")    
                                                    }       
                                       });
                         }
             }
//改变显示的县区列表
	function changedistrict(obj){
		var b=$(obj).val();
		if(b!=0){
			$.ajax({
                                                    type: "POST",
                                                    url: "<?php echo u('/API/Address/loaddistrict');?>",
                                                    data: {"cityid":b},
                                                    dataType: "json",
                                                    success: function (res) {   
                                                                 $("#seldistrict").html("<option value=''>请选择县区</option>");
                                                                 $.each(res.data, function(i, item) {
                                                                             $("#seldistrict").append("<option value='" + item.id + "'>" + item.districtname + "</option>");
                                                                  });
                                                    },  
                                                    eror: function (res) {   
                                                                 alert("请求超时!")    
                                                    }       
                                       });
		}
	}
	//确认是否删除地址
	function deladdress(obj){
                          if(confirm("确定要删除此收货地址吗？")){
                          	var addressid = $(obj).parents(".user-addresslist").attr('cid');
                          	$.post("/API/Address/deladdress",{"addressid":addressid},function(res){
                          		alert(res.data);
                          	});	
                          }else{
                          }
             }	
</script>

	</body>

</html>